package cn.jjzd.info.api;

import cn.jjzd.common.pojo.PageResult;
import cn.jjzd.info.response.ArticleListResponse;
import cn.jjzd.info.response.ArticlePageResponse;
import cn.jjzd.info.request.ArticleRequest;
import cn.jjzd.info.pojo.Article;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("article")
public interface ArticleApi {
    /*@GetMapping("list")
    public Map<String,List<SysArticleBo>> queryArticleListByCids(@RequestParam("cids") List<Long> cids);*/

    @GetMapping("{id}")
    public Article queryById(@PathVariable("id") Long id);

    @GetMapping("page")
    public PageResult<ArticlePageResponse> queryArticlePage(
            @RequestParam(value = "key",required = false)String key,
            @RequestParam(value = "page",defaultValue = "1")Integer page,
            @RequestParam(value = "rows",defaultValue = "5")Integer rows,
            @RequestParam(value = "sortBy",required = false)String sortBy,
            @RequestParam(value = "desc",required = false)Boolean desc,
            @RequestParam(value = "cid",required = false)Long cid
    );

    @PostMapping("morePage")
    public PageResult<ArticleListResponse> queryArticlePage(@RequestBody ArticleRequest request);
}
